#include "../../../sql/ast/statement/SQLExplainStatement.h"
#include "../../../sql/visitor/SQLASTVisitor.h"

SQLExplainStatement::SQLExplainStatement()
{
  hints = std::make_shared<std::list<SQLCommentHint_ptr>>();
}

SQLExplainStatement::SQLExplainStatement(DbType_ptr  dbType)
    : SQLStatementImpl(dbType)
{
  hints = std::make_shared<std::list<SQLCommentHint_ptr>>();
}

SQLStatement_ptr  SQLExplainStatement::getStatement()
{
  return statement;
}

void SQLExplainStatement::setStatement(SQLStatement_ptr  statement)
{
  if (statement != nullptr)
  {
    statement->setParent(SharedObject(SQLExplainStatement));
  }
  this->statement = statement;
}

string_ptr  SQLExplainStatement::getType()
{
  return type;
}

void SQLExplainStatement::setType(string_ptr  type)
{
  this->type = type;
}

//@Override
void SQLExplainStatement::accept0(SQLASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(SQLExplainStatement)))
  {
    acceptChild(visitor, statement);
  }
  visitor->endVisit(SharedObject(SQLExplainStatement));
}

SQLCommentHint_list_ptr SQLExplainStatement::getHints()
{
  return hints;
}

void SQLExplainStatement::setHints(SQLCommentHint_list_ptr hints)
{
  this->hints = hints;
}

//@Override
SQLObject_list_ptr  SQLExplainStatement::getChildren()
{
  SQLObject_list_ptr  children = std::make_shared<std::list<SQLObject_ptr>>();
  if (statement != nullptr)
  {
    children->push_back(std::dynamic_pointer_cast<SQLObject>(statement));
  }
  return children;
}

BOOL_ptr SQLExplainStatement::isExtended()
{
  return extended;
}

void SQLExplainStatement::setExtended(BOOL_ptr extended)
{
  this->extended = extended;
}

BOOL_ptr SQLExplainStatement::isDependency()
{
  return dependency;
}

void SQLExplainStatement::setDependency(BOOL_ptr dependency)
{
  this->dependency = dependency;
}

BOOL_ptr SQLExplainStatement::isAuthorization()
{
  return authorization;
}

void SQLExplainStatement::setAuthorization(BOOL_ptr authorization)
{
  this->authorization = authorization;
}

BOOL_ptr SQLExplainStatement::isOptimizer()
{
  return optimizer;
}

void SQLExplainStatement::setOptimizer(BOOL_ptr optimizer)
{
  this->optimizer = optimizer;
}

string_ptr  SQLExplainStatement::getFormat()
{
  return format;
}

void SQLExplainStatement::setFormat(string_ptr  format)
{
  this->format = format;
}

BOOL_ptr SQLExplainStatement::isParenthesis()
{
  return parenthesis;
}

void SQLExplainStatement::setParenthesis(BOOL_ptr parenthesis)
{
  this->parenthesis = parenthesis;
}
